package com.wl.dzt.basic.service.callback;

import com.wl.dzt.basic.entity.BasicConfig;
import com.wl.dzt.basic.entity.BasicOrganization;
import com.wl.dzt.basic.entity.BasicUser;
import com.wl.dzt.sys.core.dao.DB;
import com.wl.dzt.sys.core.dao.select.term.Term;

/**
 * @author wl_code@163.com
 * @version 1.0
 * @date 2018/7/11/011
 * @description 短信发送开关
 */
public interface SmsSendSwitchCallback {

    /**
     * 默认调用发送方法
     */
    void send();

    /**
     * 判断短信开关是否打开
     *
     * @param callback
     */
    static void handler(String organId, SmsSendSwitchCallback callback) {
        BasicConfig config = DB.get(BasicConfig.class, new Term[]{Term.eq("organId.id", organId)});
        //短信开关打开了..
        if (config != null && config.getMsgFlag().equals("1")) {
//            执行回调
            callback.send();
        }
    }
}
